
#include "core/pool.h"
#include "vetest.h"

#define VE_MAX_TEST_STRUCTS 32

typedef struct
{
	int   int_field;
	float float_field;
} VETestStruct;
VE_DEFINE_STATIC_POOL(VETestStruct,VE_MAX_TEST_STRUCTS)

int main()
{
	int i;
	VETestStruct *tmp[VE_MAX_TEST_STRUCTS];

	for( i = 0; i < VE_MAX_TEST_STRUCTS; ++i )
	{
		tmp[i] = ve_pool_alloc_VETestStruct();
		VE_VERIFY( tmp[i] == (g_mem_VETestStruct + i) );
	}

	VE_VERIFY( ve_pool_alloc_VETestStruct() == 0 );
	VE_VERIFY( ve_pool_alloc_VETestStruct() == 0 );

	ve_pool_free_VETestStruct( tmp[0] );
	ve_pool_free_VETestStruct( tmp[1] );

	VE_VERIFY( ve_pool_alloc_VETestStruct() != 0 );
	VE_VERIFY( ve_pool_alloc_VETestStruct() != 0 );

	VE_VERIFY( ve_pool_alloc_VETestStruct() == 0 );
	VE_VERIFY( ve_pool_alloc_VETestStruct() == 0 );

	return 0;
}
